#ifndef PLAYER_H
#define PLAYER_H

#include <QObject>
#include <QPainter>
#include <QTimer>
#include <QPixmap>
#include "bullet.h"

class Player : public QObject
{
    Q_OBJECT

public:
    Player();
    ~Player();

    void draw(QPainter *painter);
    void move(qreal dx, qreal dy, qint32 width, qint32 height);
    void rotate(qint32 toX, qint32 toY);
    Bullet *fire();
    bool intersects(Asteroid *asteroid);

private slots:
    void reload();

private:
    const static qreal m_speed;

    QPixmap m_pixmap;

    qreal m_x;
    qreal m_y;
    qreal m_angle;
    qreal m_angleInRads;

    bool m_isReadyToFire;

    QTimer *m_reloadTimer;
};

#endif // PLAYER_H
